<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: 武露斌
  Date: 2021/11/4
  Time: 14:16
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <script src="../../js/jquery-1.8.2.min.js"></script>
    <script src="../../js/fileupload.js"></script>
    <link rel="stylesheet" href="../../css/img.css">
    <link rel="stylesheet" href="../../css/css.css">
</head>
<body>

<h2>欢迎${user.uname}登录</h2>
<input type="button" value="注销" onclick="zx()">
<form action="list.do" method="post">
    <input type="hidden" name="pageNum"><br>
    收货单号：<input type="text" name="danhao" value="${map.danhao}"><br>
    制单时间范围查询：<input type="text" name="zsta" value="${map.zsta}">---
    <input type="text" name="zends" value="${map.zends}"><br>

    收货日期范围:<input type="text" name="ssta" value="${map.ssta}">--
    <input type="text" name="sends" value="${map.sends}">
    <br>
    优先级范围:<input type="text" name="psta"value="${map.psta}">--
    <input type="text" name="pends" value="${map.pends}">
    <br>
    客户模糊查询：<input type="text" name="cname" value="${map.cname}"><br>
    客户发货单列表模糊查询：<input type="text" name="fahuodan" value="${map.fahuodan}"><br>
    制单人模糊查询：<input type="text" name="zdren" value="${map.zdren}"><br>
    制单人工号模糊查询：<input type="text" name="zdrenhao" value="${map.zdrenhao}"><br>
    备注你模糊查询：<input type="text" name="beizhu" value="${map.beizhu}"><br>

    优先级排序:
    <select name="xx">
        <option value="">请选择排序方式</option>
        <option value="desc" ${map.xx=='desc'?'selected':''}>倒叙</option>
        <option value="asc" ${map.xx=='asc'?'selected':''}>正序</option>
    </select>

    <input type="submit" value="查询">
    <input type="button" value="刷新" onclick="sx()">
</form>

<table border="1">
    <tr>
        <th>序号</th>
        <th>收货日期</th>
        <th>收货单号</th>
        <th>优先级</th>
        <th>状态</th>
        <th>备注</th>
        <th>客户</th>
        <th>客户发货单列表</th>
        <th>制单人工号</th>
        <th>制单人</th>
        <th>制单时间</th>
        <th>收货附件</th>
        <th>
            <input type="button" value="添加" onclick="add()">
        </th>
    </tr>
    <c:forEach items="${pageInfo.list}" var="a">
        <tr>
            <td>${a.sid}</td>
            <td>${a.datime}</td>
            <td>${a.danhao}</td>
            <td>${a.priority}</td>
            <td>${a.states}</td>
            <td>${a.beizhu}</td>
            <td>${a.cname}</td>
            <td>${a.fahuodan}</td>
            <td>${a.zdrenhao}</td>
            <td>${a.zdren}</td>
            <td>${a.zdtime}</td>
<%--            <td>${a.zdtime}</td>--%>
            <td>
                <img src="${a.imgs}" width="60">
            </td>
            <td>
                <c:if test="${a.states=='已取消'}">
                    已取消
                </c:if>
                <c:if test="${a.states!='已取消'}">
                    <input type="button" value="取消" onclick="qx(${a.sid})">
                </c:if>
            </td>
        </tr>
    </c:forEach>

    <tr>
        <td colspan="20">
            <input type="button" value="首页" onclick="fy(1)">
            <input type="button" value="上一页" onclick="fy(${pageInfo.isFirstPage?1:pageInfo.prePage})">
            <c:forEach items="${pageInfo.navigatepageNums}" var="index">
                <input type="button" value="${index}" onclick="fy(${index})">
            </c:forEach>
            <input type="button" value="下一页" onclick="fy(${pageInfo.isLastPage?pageInfo.pages:pageInfo.nextPage})">
            <input type="button" value="尾页" onclick="fy(${pageInfo.pages})">
        </td>
    </tr>
</table>


</body>
</html>
<script>

    function fy(pageNum) {
        $("[name='pageNum']").val(pageNum)
        $("form").submit();
    }

    function sx() {
        location="list.do"
    }

    function add() {
        location="addto.do"
    }

    function qx(sid) {
        //alert(sid)
        $.ajax({
            url:"updaqx.do",
            data:{"sid":sid},
            type:"post",
            dataType:"json",
            success:function (data) {
                if (data>0){
                    alert("修改成功")
                    location="list.do"
                }else{
                    alert("修改失败")
                }
            }
        })
    }

    function zx() {
        location="zx.do"
    }

</script>
















